
cmake_minimum_required(VERSION 3.22.1)

project("fri_osid_test")

include_directories(include)
include_directories(include/cutil)
include_directories(include/ipc_core/include)
include_directories(include/samgr_proxy/include)
include_directories(fri fri/osid)

add_library(fri_osid_proxy SHARED osid_interface.cpp osid_manager_proxy.cpp)

add_library(hilog SHARED IMPORTED)
set_target_properties(hilog PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libhilog.so)

add_library(cplusplus SHARED IMPORTED)
set_target_properties(cplusplus PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libc++.so)

add_library(ipc_core SHARED IMPORTED)
set_target_properties(ipc_core PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libipc_core.z.so)

add_library(samgr_proxy SHARED IMPORTED)
set_target_properties(samgr_proxy PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libsamgr_proxy.z.so)

add_library(system_ability_fwk SHARED IMPORTED)
set_target_properties(system_ability_fwk PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libsystem_ability_fwk.z.so)

add_library(utils SHARED IMPORTED)
set_target_properties(utils PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libs/libutils.z.so)

target_link_libraries(fri_osid_proxy
#        system_ability_fwk
        utils
        samgr_proxy
        ipc_core
        cplusplus
        hilog
)
set(ANDROID_ALLOW_UNDEFINED_SYMBOLS true)
#target_compile_options(fri_osid_proxy PUBLIC -fno-rtti)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --allow-shlib-undefined")
add_executable(fri_osid_test_hos fri_osid_test.cpp)
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --allow-shlib-undefined")
#target_compile_options(fri_osid_test_hos PUBLIC -fno-rtti)
# Specifies libraries CMake should link to your target library. You
# can link libraries from various origins, such as libraries defined in this
# build script, prebuilt third-party libraries, or Android system libraries.
target_link_libraries(fri_osid_test_hos
        fri_osid_proxy
#        system_ability_fwk
        utils
        samgr_proxy
        ipc_core
        cplusplus
        hilog
)
